package com.example.hello1;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;

import java.util.ArrayList;

public class Myadapter extends ArrayAdapter {
    private static final String Tag= "myadpter";

    public Myadapter(@NonNull Context context, int resource, ArrayList<RateItem> list) {
        super(context, resource, list);
    }
   public View getView(int position, View convertView, ViewGroup parent){
       View itemView = convertView;
       if(itemView==null)
       {
           itemView= LayoutInflater.from(getContext()).inflate(R.layout.list_rate,
                   parent,false);
       }
//       Map<String,String> map = (Map<String,String>)getItem(position);
      RateItem item = (RateItem)getItem(position);
       TextView title = itemView.findViewById(R.id.itemTitle);
       TextView detail = itemView.findViewById(R.id.itemDetail);
//       title.setText(map.get("ItemTitle"));
//       detail.setText(map.get("ItemDetail"));
       title.setText(item.getCname());
       detail.setText(item.getCval());


       return itemView;


   }

}
